-
Notifications
You must be signed in to change notification settings - Fork 312
Implement Config Inversion with Default Strictness of Warning
#9539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mhlidd/test
Are you sure you want to change the base?
Conversation
1a576ea
to
512b2c6
Compare
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 55 metrics, 4 unstable metrics. Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.54.0-SNAPSHOT~8ba684e640, baseline=1.54.0-SNAPSHOT~61c2d97420
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.014 s) : 0, 1014475
Total [baseline] (8.674 s) : 0, 8673701
Agent [candidate] (1.008 s) : 0, 1007856
Total [candidate] (8.706 s) : 0, 8706350
section iast
Agent [baseline] (1.145 s) : 0, 1144858
Total [baseline] (9.277 s) : 0, 9276952
Agent [candidate] (1.152 s) : 0, 1151752
Total [candidate] (9.285 s) : 0, 9284912
gantt
title insecure-bank - break down per module: candidate=1.54.0-SNAPSHOT~8ba684e640, baseline=1.54.0-SNAPSHOT~61c2d97420
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.475 ms) : 0, 1475
crashtracking [candidate] (1.455 ms) : 0, 1455
BytebuddyAgent [baseline] (694.782 ms) : 0, 694782
BytebuddyAgent [candidate] (689.628 ms) : 0, 689628
GlobalTracer [baseline] (249.6 ms) : 0, 249600
GlobalTracer [candidate] (248.762 ms) : 0, 248762
AppSec [baseline] (31.145 ms) : 0, 31145
AppSec [candidate] (30.983 ms) : 0, 30983
Debugger [baseline] (6.407 ms) : 0, 6407
Debugger [candidate] (6.369 ms) : 0, 6369
Remote Config [baseline] (691.389 µs) : 0, 691
Remote Config [candidate] (684.026 µs) : 0, 684
Telemetry [baseline] (9.056 ms) : 0, 9056
Telemetry [candidate] (8.893 ms) : 0, 8893
section iast
crashtracking [baseline] (1.463 ms) : 0, 1463
crashtracking [candidate] (1.453 ms) : 0, 1453
BytebuddyAgent [baseline] (809.932 ms) : 0, 809932
BytebuddyAgent [candidate] (815.344 ms) : 0, 815344
GlobalTracer [baseline] (237.172 ms) : 0, 237172
GlobalTracer [candidate] (238.555 ms) : 0, 238555
IAST [baseline] (26.033 ms) : 0, 26033
IAST [candidate] (26.122 ms) : 0, 26122
AppSec [baseline] (33.932 ms) : 0, 33932
AppSec [candidate] (34.046 ms) : 0, 34046
Debugger [baseline] (6.047 ms) : 0, 6047
Debugger [candidate] (6.089 ms) : 0, 6089
Remote Config [baseline] (593.77 µs) : 0, 594
Remote Config [candidate] (607.421 µs) : 0, 607
Telemetry [baseline] (8.419 ms) : 0, 8419
Telemetry [candidate] (8.426 ms) : 0, 8426
Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.54.0-SNAPSHOT~8ba684e640, baseline=1.54.0-SNAPSHOT~61c2d97420
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.006 s) : 0, 1005769
Total [baseline] (10.672 s) : 0, 10672246
Agent [candidate] (1.005 s) : 0, 1004798
Total [candidate] (10.7 s) : 0, 10699587
section appsec
Agent [baseline] (1.185 s) : 0, 1185118
Total [baseline] (10.975 s) : 0, 10975060
Agent [candidate] (1.199 s) : 0, 1198632
Total [candidate] (10.963 s) : 0, 10963057
section iast
Agent [baseline] (1.146 s) : 0, 1145919
Total [baseline] (10.953 s) : 0, 10953235
Agent [candidate] (1.145 s) : 0, 1144850
Total [candidate] (10.974 s) : 0, 10973522
section profiling
Agent [baseline] (1.154 s) : 0, 1154240
Total [baseline] (11.032 s) : 0, 11032086
Agent [candidate] (1.149 s) : 0, 1149474
Total [candidate] (11.047 s) : 0, 11046664
gantt
title petclinic - break down per module: candidate=1.54.0-SNAPSHOT~8ba684e640, baseline=1.54.0-SNAPSHOT~61c2d97420
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.456 ms) : 0, 1456
crashtracking [candidate] (1.454 ms) : 0, 1454
BytebuddyAgent [baseline] (688.47 ms) : 0, 688470
BytebuddyAgent [candidate] (687.117 ms) : 0, 687117
GlobalTracer [baseline] (247.925 ms) : 0, 247925
GlobalTracer [candidate] (248.099 ms) : 0, 248099
AppSec [baseline] (30.747 ms) : 0, 30747
AppSec [candidate] (31.009 ms) : 0, 31009
Debugger [baseline] (6.354 ms) : 0, 6354
Debugger [candidate] (6.382 ms) : 0, 6382
Remote Config [baseline] (671.284 µs) : 0, 671
Remote Config [candidate] (686.526 µs) : 0, 687
Telemetry [baseline] (8.963 ms) : 0, 8963
Telemetry [candidate] (8.949 ms) : 0, 8949
section appsec
crashtracking [baseline] (1.451 ms) : 0, 1451
crashtracking [candidate] (1.489 ms) : 0, 1489
BytebuddyAgent [baseline] (710.308 ms) : 0, 710308
BytebuddyAgent [candidate] (719.216 ms) : 0, 719216
GlobalTracer [baseline] (239.69 ms) : 0, 239690
GlobalTracer [candidate] (242.484 ms) : 0, 242484
AppSec [baseline] (173.036 ms) : 0, 173036
AppSec [candidate] (172.636 ms) : 0, 172636
Debugger [baseline] (5.925 ms) : 0, 5925
Debugger [candidate] (6.844 ms) : 0, 6844
Remote Config [baseline] (636.367 µs) : 0, 636
Remote Config [candidate] (658.216 µs) : 0, 658
Telemetry [baseline] (8.409 ms) : 0, 8409
Telemetry [candidate] (9.312 ms) : 0, 9312
IAST [baseline] (24.574 ms) : 0, 24574
IAST [candidate] (24.76 ms) : 0, 24760
section iast
crashtracking [baseline] (1.465 ms) : 0, 1465
crashtracking [candidate] (1.462 ms) : 0, 1462
BytebuddyAgent [baseline] (810.194 ms) : 0, 810194
BytebuddyAgent [candidate] (809.905 ms) : 0, 809905
GlobalTracer [baseline] (237.767 ms) : 0, 237767
GlobalTracer [candidate] (237.266 ms) : 0, 237266
AppSec [baseline] (33.7 ms) : 0, 33700
AppSec [candidate] (33.941 ms) : 0, 33941
Debugger [baseline] (6.144 ms) : 0, 6144
Debugger [candidate] (6.074 ms) : 0, 6074
Remote Config [baseline] (596.414 µs) : 0, 596
Remote Config [candidate] (602.899 µs) : 0, 603
Telemetry [baseline] (8.434 ms) : 0, 8434
Telemetry [candidate] (8.445 ms) : 0, 8445
IAST [baseline] (26.226 ms) : 0, 26226
IAST [candidate] (25.979 ms) : 0, 25979
section profiling
ProfilingAgent [baseline] (101.21 ms) : 0, 101210
ProfilingAgent [candidate] (101.126 ms) : 0, 101126
crashtracking [baseline] (1.453 ms) : 0, 1453
crashtracking [candidate] (1.422 ms) : 0, 1422
BytebuddyAgent [baseline] (719.677 ms) : 0, 719677
BytebuddyAgent [candidate] (717.55 ms) : 0, 717550
GlobalTracer [baseline] (224.317 ms) : 0, 224317
GlobalTracer [candidate] (222.46 ms) : 0, 222460
AppSec [baseline] (31.251 ms) : 0, 31251
AppSec [candidate] (31.221 ms) : 0, 31221
Debugger [baseline] (6.485 ms) : 0, 6485
Debugger [candidate] (7.242 ms) : 0, 7242
Remote Config [baseline] (710.786 µs) : 0, 711
Remote Config [candidate] (713.472 µs) : 0, 713
Telemetry [baseline] (16.138 ms) : 0, 16138
Telemetry [candidate] (15.523 ms) : 0, 15523
Profiling [baseline] (102.447 ms) : 0, 102447
Profiling [candidate] (101.726 ms) : 0, 101726
LoadParameters
See matching parameters
SummaryFound 5 performance improvements and 1 performance regressions! Performance is the same for 6 metrics, 12 unstable metrics.
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~8ba684e640, baseline=1.54.0-SNAPSHOT~61c2d97420
dateFormat X
axisFormat %s
section baseline
no_agent (36.632 ms) : 36336, 36927
. : milestone, 36632,
appsec (46.97 ms) : 46555, 47385
. : milestone, 46970,
code_origins (44.181 ms) : 43794, 44568
. : milestone, 44181,
iast (44.987 ms) : 44614, 45360
. : milestone, 44987,
profiling (48.928 ms) : 48464, 49392
. : milestone, 48928,
tracing (45.242 ms) : 44849, 45636
. : milestone, 45242,
section candidate
no_agent (34.929 ms) : 34652, 35205
. : milestone, 34929,
appsec (47.357 ms) : 46949, 47765
. : milestone, 47357,
code_origins (43.0 ms) : 42636, 43363
. : milestone, 43000,
iast (44.178 ms) : 43808, 44548
. : milestone, 44178,
profiling (46.674 ms) : 46255, 47093
. : milestone, 46674,
tracing (44.63 ms) : 44260, 45000
. : milestone, 44630,
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~8ba684e640, baseline=1.54.0-SNAPSHOT~61c2d97420
dateFormat X
axisFormat %s
section baseline
no_agent (4.357 ms) : 4303, 4412
. : milestone, 4357,
iast (9.726 ms) : 9558, 9893
. : milestone, 9726,
iast_FULL (14.788 ms) : 14491, 15085
. : milestone, 14788,
iast_GLOBAL (10.974 ms) : 10776, 11171
. : milestone, 10974,
profiling (9.277 ms) : 9113, 9440
. : milestone, 9277,
tracing (7.916 ms) : 7787, 8045
. : milestone, 7916,
section candidate
no_agent (4.19 ms) : 4143, 4236
. : milestone, 4190,
iast (10.483 ms) : 10306, 10660
. : milestone, 10483,
iast_FULL (13.756 ms) : 13476, 14036
. : milestone, 13756,
iast_GLOBAL (10.184 ms) : 10008, 10361
. : milestone, 10184,
profiling (9.272 ms) : 9125, 9418
. : milestone, 9272,
tracing (7.766 ms) : 7657, 7875
. : milestone, 7766,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 11 metrics, 1 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~8ba684e640, baseline=1.54.0-SNAPSHOT~61c2d97420
dateFormat X
axisFormat %s
section baseline
no_agent (1.478 ms) : 1467, 1490
. : milestone, 1478,
appsec (3.652 ms) : 3440, 3864
. : milestone, 3652,
iast (2.21 ms) : 2147, 2273
. : milestone, 2210,
iast_GLOBAL (2.251 ms) : 2188, 2315
. : milestone, 2251,
profiling (2.054 ms) : 2003, 2105
. : milestone, 2054,
tracing (2.024 ms) : 1975, 2073
. : milestone, 2024,
section candidate
no_agent (1.481 ms) : 1469, 1492
. : milestone, 1481,
appsec (3.748 ms) : 3530, 3966
. : milestone, 3748,
iast (2.201 ms) : 2138, 2264
. : milestone, 2201,
iast_GLOBAL (2.256 ms) : 2193, 2320
. : milestone, 2256,
profiling (2.056 ms) : 2006, 2107
. : milestone, 2056,
tracing (2.023 ms) : 1974, 2072
. : milestone, 2023,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~8ba684e640, baseline=1.54.0-SNAPSHOT~61c2d97420
dateFormat X
axisFormat %s
section baseline
no_agent (14.735 s) : 14735000, 14735000
. : milestone, 14735000,
appsec (15.174 s) : 15174000, 15174000
. : milestone, 15174000,
iast (18.458 s) : 18458000, 18458000
. : milestone, 18458000,
iast_GLOBAL (18.008 s) : 18008000, 18008000
. : milestone, 18008000,
profiling (15.317 s) : 15317000, 15317000
. : milestone, 15317000,
tracing (15.034 s) : 15034000, 15034000
. : milestone, 15034000,
section candidate
no_agent (15.47 s) : 15470000, 15470000
. : milestone, 15470000,
appsec (14.935 s) : 14935000, 14935000
. : milestone, 14935000,
iast (18.359 s) : 18359000, 18359000
. : milestone, 18359000,
iast_GLOBAL (18.266 s) : 18266000, 18266000
. : milestone, 18266000,
profiling (14.945 s) : 14945000, 14945000
. : milestone, 14945000,
tracing (15.095 s) : 15095000, 15095000
. : milestone, 15095000,
|
🎯 Code Coverage 🔗 Commit SHA: 8ba684e | Docs | Was this helpful? Give us feedback! |
Warning
Hi! 👋 Thanks for your pull request! 🎉 To help us review it, please make sure to:
If you need help, please check our contributing guidelines. |
aa18112
to
606dfd0
Compare
606dfd0
to
7cea99b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 praise: Thanks for splitting the PR related to your config changes, that really helps to review 👍
🎯 suggestion: I would recommend trying to decrease the overall (cognitive) complexity by refactoring using new few methods to de-duplicate code and give more meaning.
For example this should have its own function with a meaningful name:
if (key.startsWith("DD_")
|| key.startsWith("OTEL_")
|| configSource.getAliasMapping().containsKey(key))
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class ConfigHelper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 suggestion: Helper class usually are final
and have a private
constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also wondering if this could be made into a singleton as well... and if so there would be no reason to have static methods under it. Not sure if that is the right or wrong direction to go in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, an helper class does not have a state. So if you have a state but only one instance, that would be a singleton.
Here might be a big ambiguous because most of the state is immutable, right? It's more like a big static data table and calling the helper methods won't mutate it. But as you have the StrictStyle thing that can change the behavior, I would with a singleton.
Keep in mind helper class / methods should be easier to test than singleton that usually are painful to deal with on test scenario.
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigInversionStrictStyle.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
+ (configSource.getAliasMapping().containsKey(key) | ||
? "Please use " + configSource.getAliasMapping().get(key) + " instead." | ||
: configSource.getDeprecatedConfigurations().get(key)); | ||
System.err.println(warning); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/
❔ question: Is it expected to log on System.err
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to a log just now. (I remember there was something weird with logging when I first implemented but that might have been due to something separate.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is issue with the initializing the logging framework too early. This will depend on the usage that's done of the config helper. It might break in bootstrap for example, while reporting to system.err won't be great once we bootstrap.
There might be some new design constraints here... 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would very possibly be an issue, given that this class will likely be invoked at bootstrap, and initialize the logger.
I agree that keeping system.err
is suboptimal. One option is to not use the ConfigHelper
at all in bootstrap, which we could do unless there is a better solution...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PerfectSlayer Stuart seemed to be in agreement that avoiding ConfigHelper
in bootstrap during the migration to ConfigHelper
is viable since few configs are used there and are rarely changed. Using logging here should be fine for this PR, and I'll take note to not migrate bootstrap for the followup PR
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigInversionStrictStyle.java
Outdated
Show resolved
Hide resolved
utils/config-utils/src/main/java/datadog/trace/config/inversion/ConfigHelper.java
Outdated
Show resolved
Hide resolved
57483a2
to
1574d9b
Compare
a20edf0
to
bb4f47c
Compare
…adability and hide supported-configuration details
12e5514
to
5fe0a88
Compare
… ControllableEnvironmentVariables
Debugger benchmarksParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 10 metrics, 5 unstable metrics. See unchanged results
Request duration reports for reportsgantt
title reports - request duration [CI 0.99] : candidate=None, baseline=None
dateFormat X
axisFormat %s
section baseline
noprobe (323.559 µs) : 284, 363
. : milestone, 324,
basic (281.378 µs) : 275, 288
. : milestone, 281,
loop (8.969 ms) : 8964, 8974
. : milestone, 8969,
section candidate
noprobe (312.735 µs) : 292, 333
. : milestone, 313,
basic (280.181 µs) : 274, 287
. : milestone, 280,
loop (8.959 ms) : 8955, 8964
. : milestone, 8959,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good.
Left a comment about unnecessary allocation.
What Does This Do
This PR implements basic Config Inversion, aiming to document all DD/OTEL environment variables used in the repo in a
supported-configurations.json
file.Components:
ConfigInversionStrictStyle.java
Strict
which does not allow any usage of an unknown DD/OTEL environment variable,Warning
which allows the usage but sends telemetry about unknown environment variables, andTest
which allows the usage of unknown environment variables without sending telemetry.Warning
ConfigHelper.java
supported-configurations.json
to ensure the environment variable queried for is "known"ConfigInversionStrictStyle
that is set.Motivation
This PR supports the general Config Inversion theme that has already been implemented in dd-trace-js and currently being implemented in dd-trace-go and dd-trace-rb. Here is the RFC that documents what this project entails.
Additional Notes
This is a follow-up to
ConfigInversionMetricCollector
toconfig-utils
module #9566Contributor Checklist
type:
and (comp:
orinst:
) labels in addition to any usefull labelsclose
,fix
or any linking keywords when referencing an issue.Use
solves
instead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]